<template>
  <div class="index-box">
      <h2 style="margin-bottom: 10px;">字典 this.getSelectList('sys_user_sex').then(res=>{
            this.sys_user_sex = res.data;
          }) &nbsp;&nbsp;&nbsp;  dictLabel  dictValue</h2>
      <div>
        <el-row :gutter="20" v-for="item in dictionariesList" style="margin-bottom: 10px;">
          <el-col :span="3" style="text-align: right;">{{item.dictName}} {{item.dictType}}</el-col>
          <el-col :span="21"> <el-tag v-for="i in item.detail" style="margin-right:10px;">{{i.dictLabel}}{{i.dictValue}}</el-tag></el-col>
        </el-row>
      </div>

      <h2 style="margin-bottom: 10px;">分类 this.getCategoryDetails({categoryKey:'application_category'}).then(res=>{
            this.application_category = res.data;
          }) &nbsp;&nbsp;&nbsp;  name  levelId</h2>
      <div>
        <el-row :gutter="20" v-for="item in classifyList" style="margin-bottom: 10px;">
          <el-col :span="3" style="text-align: right;">{{item.dictLabel}} {{item.dictValue}}</el-col>
          <el-col :span="21"> <el-tag v-for="i in item.detail" style="margin-right:10px;">{{i.name}}</el-tag></el-col>
        </el-row>
      </div>
  </div>
</template>

<script>

import {
    dictionarieslistType,
    getCategoryList
  } from '@/api/getData'
export default {
  name: "webClassify",
  data() {
    return {
      // 遮罩层
      loading: true,
      dictionariesList:[],
      classifyList:[],
    };
  },
  created() {
    this.dataList();
    this.getCategoryList();
  },
  mounted() {

  },
  methods: {
    getCategoryList(dictId) {
      let that = this;
      getCategoryList().then(response => {
        let data = response.data
        console.log(data);
        for(let i=0;i<data.length;i++){
          console.log(data[i].dictValue)
          that.getCategoryDetails({categoryKey:data[i].dictValue}).then(res=>{
            data[i].detail = res.data;
          })
        }
        setTimeout(()=>{
          this.classifyList = data;
        },2000)
      });
    },
    dataList() {
      let that = this;
      dictionarieslistType().then(response => {
        let data = response.rows
        for(let i=0;i<data.length;i++){
          that.getSelectList(data[i].dictType).then(res=>{
            data[i].detail = res.data;
          })
        }
        setTimeout(()=>{
          this.dictionariesList = data;
        },2000)
      });
    },

  }
};
</script>

<style lang="scss" scoped>
  .console {
    font-size: 30px;
    text-align: center;
    margin-top: 350px;
  }
</style>
